<!DOCTYPE html>

<html>
	<head>
		<link rel="stylesheet" href="../../../themes/themeroller/maemo5-theme/ui.all.css" type="text/css" media="screen" />
		<link rel="stylesheet" href="../../../themes/nokia/ext-theme/maemo5/800x480/custom.css" type="text/css" media="screen" />
		
		<script src="../../../lib/jquery/jquery.js" type="text/javascript" charset="utf-8"></script>
		
		<script src="../../../src/defaults.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../src/core.js" type="text/javascript" charset="utf-8"></script>
				
		<style type="text/css" media="screen">
			body {
				font-size: 14px;
				padding: 15px;
				font-family: "Trebuchet MS", "Helvetica", "Arial",  "Verdana", "sans-serif";
			}

			p {
				margin: 30px 10px;
			}

			#library, #entertainment, #health, #romance {
				width: 330px;
			}
		</style>

	</head>

	<body>

		<h1>Nokia.TransitionList - Sample</h1>

		<br/><br/>

		<div id="library"></div>
		<div id="entertainment"></div>
		<div id="health"></div>
		<div id="romance"></div>
		<div id="professional"></div>
		<div id="politics"></div>

		<script type="text/javascript" charset="utf-8">

			var init = function() {
				
				window.bookStore = new Nokia.TransitionList({
					element: '#library',
					title: 'Book Store',
					visible: true,
					create: function() {
						console.log("create");
					},
					show: function(openerTransitionList) {
						console.log("show", openerTransitionList);
					},
					hide: function() {
						console.log("hide list1.");
					},
					addItem: function(event, item) {
						console.log("addItem", item);
					},
					removeItem: function(event, item) {
						console.log("removeItem", item);
					}
				});

				window.entertainment = new Nokia.TransitionList({
					title: 'Entertainment',
					element: '#entertainment'
				});

				window.health = new Nokia.TransitionList({
					title: 'Health',
					element: '#health'
				});

				window.romance = new Nokia.TransitionList({
					title: 'Romance',
					element: '#romance'
				});

				window.professional = new Nokia.TransitionList({
					title: 'Professional & Technical',
					element: '#professional'
				});

				window.politics = new Nokia.TransitionList({
					title: 'Politics',
					element: '#politics'
				});

				bookStore.addItem(
					new Nokia.TransitionListItem({
						label: 'Entertainment',
						linkedList: window.entertainment,
						click: function() {}
					})
				);

				bookStore.addItem(
					new Nokia.TransitionListItem({
						label: 'Romance',
						linkedList: window.romance,
						click: function() {}
					})
				);

				bookStore.addItem(
					new Nokia.TransitionListItem({
						label: 'Health, Mind & Body',
						linkedList: window.health,
						click: function() {}
					})
				);

				var createLibrarySection = function(transitionList, linkedListMain) {
					transitionList.addItem(
						new Nokia.TransitionListItem({
							label: 'Back to list',
							icon: 'ui-icon-triangle-1-w',
							linkedList: linkedListMain,
							click: function() {}
						})
					);

					transitionList.addItem(
						new Nokia.TransitionListItem({
							label: 'Book 1',
							click: function() {
								alert('Book 1');
							}
						})
					);

					transitionList.addItem(
						new Nokia.TransitionListItem({
							label: 'Book 2',
							click: function() {
								alert('Book 2');
							}
						})
					);

					transitionList.addItem(
						new Nokia.TransitionListItem({
							label: 'Book 3',
							click: function() {
								alert('Book 3');
							}
						})
					);

					transitionList.addItem(
						new Nokia.TransitionListItem({
							label: 'Book 4',
							click: function() {
								alert('Book 4');
							}
						})
					);

					transitionList.addItem(
						new Nokia.TransitionListItem({
							label: 'Book 5',
							click: function() {
								alert('Book 5');
							}
						})
					);
				};

				createLibrarySection(window.entertainment, window.bookStore);
				createLibrarySection(window.health, window.bookStore);
				createLibrarySection(window.romance, window.bookStore);
				createLibrarySection(window.professional, window.bookStore);
				createLibrarySection(window.politics, window.bookStore);
				
				/*
				 * Hide splash when its all done.
				*/
				
				Nokia.hideSplash();

			};
			
			/*
			 * Show splash while loading components.
			*/
				
			Nokia.showSplash('<span>loading</span>');
			
			Nokia.use('transitionlist', init);

		</script>

	</body>
</html>